﻿﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;


namespace BingZi.HY.Core
{
    /// <summary>用户表</summary>
    [Serializable]
    [DataObject]
    [Description("用户表")]
    [BindIndex("PK_Sys_User", true, "UserID")]
    [BindTable("sys_User", Description = "用户表", ConnName = "System")]
    public partial class sys_UserTable<TEntity> : Isys_UserTable
    {
        #region 属性
        private Int32 _UserID = 0;
        /// <summary>用户ID号</summary>
        [DisplayName("用户ID号")]
        [Description("用户ID号")]
        [DataObjectField(true, true, false, 10)]
        [BindColumn(1, "UserID", "用户ID号", "", "int", 10, 0, false)]
        public Int32 UserID
        {
            get { return _UserID; }
            set { if (OnPropertyChanging("UserID", value)) { _UserID = value; OnPropertyChanged("UserID"); } }
        }

        private String _U_LoginName = String.Empty;
        /// <summary>登陆名</summary>
        [DisplayName("登陆名")]
        [Description("登陆名")]
        [DataObjectField(false, false, false, 20)]
        [BindColumn(2, "U_LoginName", "登陆名", null, "nvarchar(20)", 0, 0, true)]
        public String U_LoginName
        {
            get { return _U_LoginName; }
            set { if (OnPropertyChanging("U_LoginName", value)) { _U_LoginName = value; OnPropertyChanged("U_LoginName"); } }
        }

        private String _U_Password = String.Empty;
        /// <summary>密码md5加密字符</summary>
        [DisplayName("密码md5加密字符")]
        [Description("密码md5加密字符")]
        [DataObjectField(false, false, false, 32)]
        [BindColumn(3, "U_Password", "密码md5加密字符", null, "varchar(32)", 0, 0, false)]
        public String U_Password
        {
            get { return _U_Password; }
            set { if (OnPropertyChanging("U_Password", value)) { _U_Password = value; OnPropertyChanged("U_Password"); } }
        }

        private Int32 _U_GroupID = 0;
        /// <summary>部门ID号与sys_Group表中GroupID关联</summary>
        [DisplayName("部门ID号与sys_Group表中GroupID关联")]
        [Description("部门ID号与sys_Group表中GroupID关联")]
        [DataObjectField(false, false, false, 10)]
        [BindColumn(4, "U_GroupID", "部门ID号与sys_Group表中GroupID关联", null, "int", 10, 0, false)]
        public Int32 U_GroupID
        {
            get { return _U_GroupID; }
            set { if (OnPropertyChanging("U_GroupID", value)) { _U_GroupID = value; OnPropertyChanged("U_GroupID"); } }
        }

        private String _U_Email = String.Empty;
        /// <summary>电子邮件</summary>
        [DisplayName("电子邮件")]
        [Description("电子邮件")]
        [DataObjectField(false, false, true, 100)]
        [BindColumn(5, "U_Email", "电子邮件", null, "varchar(100)", 0, 0, false)]
        public String U_Email
        {
            get { return _U_Email; }
            set { if (OnPropertyChanging("U_Email", value)) { _U_Email = value; OnPropertyChanged("U_Email"); } }
        }

        private Int32 _U_EmailState = 0;
        /// <summary>邮箱认证状态(0:未认证,1:认证)</summary>
        [DisplayName("邮箱认证状态(0:未认证,1:认证)")]
        [Description("邮箱认证状态(0:未认证,1:认证)")]
        [DataObjectField(false, false, false, 3)]
        [BindColumn(6, "U_EmailState", "邮箱认证状态(0:未认证,1:认证)", "0", "tinyint", 3, 0, false)]
        public Int32 U_EmailState
        {
            get { return _U_EmailState; }
            set { if (OnPropertyChanging("U_EmailState", value)) { _U_EmailState = value; OnPropertyChanged("U_EmailState"); } }
        }



        private String _U_Phone;
        /// <summary>手机</summary>
        [DisplayName("手机")]
        [Description("手机")]
        [DataObjectField(false, false, false, 50)]
        [BindColumn(7, "U_Phone", "手机", null, "nvarchar(50)", 0, 0, true)]
        public virtual String U_Phone
        {
            get { return _U_Phone; }
            set { if (OnPropertyChanging("U_Phone", value)) { _U_Phone = value; OnPropertyChanged("U_Phone"); } }
        }

        private Int32 _U_Area;
        /// <summary>地区</summary>
        [DisplayName("地区")]
        [Description("地区")]
        [DataObjectField(false, false, false, 10)]
        [BindColumn(8, "U_Area", "地区", null, "int", 10, 0, false)]
        public virtual Int32 U_Area
        {
            get { return _U_Area; }
            set { if (OnPropertyChanging("U_Area", value)) { _U_Area = value; OnPropertyChanged("U_Area"); } }
        }

        private String _U_Address;
        /// <summary>地址</summary>
        [DisplayName("地址")]
        [Description("地址")]
        [DataObjectField(false, false, true, 255)]
        [BindColumn(9, "U_Address", "地址", null, "nvarchar(255)", 0, 0, true)]
        public virtual String U_Address
        {
            get { return _U_Address; }
            set { if (OnPropertyChanging("U_Address", value)) { _U_Address = value; OnPropertyChanged("U_Address"); } }
        }

        private Int32 _U_Type = 1;
        /// <summary>用户类型0:超级用户1:普通用户</summary>
        [DisplayName("用户类型0:超级用户1:普通用户")]
        [Description("用户类型0:超级用户1:普通用户")]
        [DataObjectField(false, false, false, 3)]
        [BindColumn(10, "U_Type", "用户类型0:超级用户1:普通用户", "1", "tinyint", 3, 0, false)]
        public Int32 U_Type
        {
            get { return _U_Type; }
            set { if (OnPropertyChanging("U_Type", value)) { _U_Type = value; OnPropertyChanged("U_Type"); } }
        }

        private Int32 _U_Status = 0;
        /// <summary>当前状态0:正常 1:禁止登陆 2:删除</summary>
        [DisplayName("当前状态0:正常 1:禁止登陆 2:删除")]
        [Description("当前状态0:正常 1:禁止登陆 2:删除")]
        [DataObjectField(false, false, false, 3)]
        [BindColumn(11, "U_Status", "当前状态0:正常 1:禁止登陆 2:删除", "1", "tinyint", 3, 0, false)]
        public Int32 U_Status
        {
            get { return _U_Status; }
            set { if (OnPropertyChanging("U_Status", value)) { _U_Status = value; OnPropertyChanged("U_Status"); } }
        }

    
        private DateTime _U_DateTime = DateTime.Now;
        /// <summary>更新时间</summary>
        [DisplayName("更新时间")]
        [Description("更新时间")]
        [DataObjectField(false, false, true, 3)]
        [BindColumn(12, "U_DateTime", "更新时间", "", "datetime", 3, 0, false)]
        public DateTime U_DateTime
        {
            get { return _U_DateTime; }
            set { if (OnPropertyChanging("U_DateTime", value)) { _U_DateTime = value; OnPropertyChanged("U_DateTime"); } }
        }

        private String _U_LastIP = String.Empty;
        /// <summary>最后访问IP</summary>
        [DisplayName("最后访问IP")]
        [Description("最后访问IP")]
        [DataObjectField(false, false, true, 15)]
        [BindColumn(13, "U_LastIP", "最后访问IP", "", "varchar(15)", 0, 0, false)]
        public String U_LastIP
        {
            get { return _U_LastIP; }
            set { if (OnPropertyChanging("U_LastIP", value)) { _U_LastIP = value; OnPropertyChanged("U_LastIP"); } }
        }

        private DateTime _U_LastDateTime = DateTime.Now;
        /// <summary>最后访问时间</summary>
        [DisplayName("最后访问时间")]
        [Description("最后访问时间")]
        [DataObjectField(false, false, true, 3)]
        [BindColumn(14, "U_LastDateTime", "最后访问时间", "", "datetime", 3, 0, false)]
        public DateTime U_LastDateTime
        {
            get { return _U_LastDateTime; }
            set { if (OnPropertyChanging("U_LastDateTime", value)) { _U_LastDateTime = value; OnPropertyChanged("U_LastDateTime"); } }
        }

        private String _U_ExtendField = String.Empty;
        /// <summary>扩展字段</summary>
        [DisplayName("扩展字段")]
        [Description("扩展字段")]
        [DataObjectField(false, false, true, 1073741823)]
        [BindColumn(15, "U_ExtendField", "扩展字段", "", "ntext", 0, 0, true)]
        public String U_ExtendField
        {
            get { return _U_ExtendField; }
            set { if (OnPropertyChanging("U_ExtendField", value)) { _U_ExtendField = value; OnPropertyChanged("U_ExtendField"); } }
        }

        private String _U_LoginType = String.Empty;
        /// <summary>登入类型(为空系统认证,其它值为其它认证)</summary>
        [DisplayName("登入类型(为空系统认证,其它值为其它认证)")]
        [Description("登入类型(为空系统认证,其它值为其它认证)")]
        [DataObjectField(false, false, true, 255)]
        [BindColumn(16, "U_LoginType", "登入类型(为空系统认证,其它值为其它认证)", "", "varchar(255)", 0, 0, false)]
        public String U_LoginType
        {
            get { return _U_LoginType; }
            set { if (OnPropertyChanging("U_LoginType", value)) { _U_LoginType = value; OnPropertyChanged("U_LoginType"); } }
        }
        #endregion

        #region 获取/设置 字段值
        /// <summary>
        /// 获取/设置 字段值。
        /// 一个索引，基类使用反射实现。
        /// 派生实体类可重写该索引，以避免反射带来的性能损耗
        /// </summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        public override Object this[String name]
        {
            get
            {
                switch (name)
                {
                    case "UserID": return _UserID;
                    case "U_LoginName": return _U_LoginName;
                    case "U_Password": return _U_Password;
                    case "U_GroupID": return _U_GroupID;
                    case "U_Email": return _U_Email;
                    case "U_EmailState": return _U_EmailState;
                    case "U_Phone": return _U_Phone;
                    case "U_Area": return _U_Area;
                    case "U_Address": return _U_Address;
                    case "U_Type": return _U_Type;
                    case "U_Status": return _U_Status;
                    case "U_DateTime": return _U_DateTime;
                    case "U_LastIP": return _U_LastIP;
                    case "U_LastDateTime": return _U_LastDateTime;
                    case "U_ExtendField": return _U_ExtendField;
                    case "U_LoginType": return _U_LoginType;
                    default: return base[name];
                }
            }
            set
            {
                switch (name)
                {
                    case "UserID": _UserID = Convert.ToInt32(value); break;
                    case "U_LoginName": _U_LoginName = Convert.ToString(value); break;
                    case "U_Password": _U_Password = Convert.ToString(value); break;
                    case "U_GroupID": _U_GroupID = Convert.ToInt32(value); break;
                    case "U_Email": _U_Email = Convert.ToString(value); break;
                    case "U_EmailState": _U_EmailState = Convert.ToInt32(value); break;
                    case "U_Phone": _U_Phone = Convert.ToString(value); break;
                    case "U_Area": _U_Area = Convert.ToInt32(value); break;
                    case "U_Address": _U_Address = Convert.ToString(value); break;
                    case "U_Type": _U_Type = Convert.ToInt32(value); break;
                    case "U_Status": _U_Status = Convert.ToInt32(value); break;
                    case "U_DateTime": _U_DateTime = Convert.ToDateTime(value); break;
                    case "U_LastIP": _U_LastIP = Convert.ToString(value); break;
                    case "U_LastDateTime": _U_LastDateTime = Convert.ToDateTime(value); break;
                    case "U_ExtendField": _U_ExtendField = Convert.ToString(value); break;
                    case "U_LoginType": _U_LoginType = Convert.ToString(value); break;
                    default: base[name] = value; break;
                }
            }
        }
        #endregion

        #region 字段名
        /// <summary>取得用户表字段信息的快捷方式</summary>
        public class _
        {
            ///<summary>用户ID号</summary>
            public static readonly FieldItem UserID = FindByName("UserID");

            ///<summary>登陆名</summary>
            public static readonly FieldItem U_LoginName = FindByName("U_LoginName");

            ///<summary>密码md5加密字符</summary>
            public static readonly FieldItem U_Password = FindByName("U_Password");

            ///<summary>部门ID号与sys_Group表中GroupID关联</summary>
            public static readonly FieldItem U_GroupID = FindByName("U_GroupID");

            ///<summary>电子邮件</summary>
            public static readonly FieldItem U_Email = FindByName("U_Email");

            ///<summary>邮箱认证状态(0:未认证,1:认证)</summary>
            public static readonly FieldItem U_EmailState = FindByName("U_EmailState");

            ///<summary>手机</summary>
            public static readonly FieldItem U_Phone = FindByName("U_Phone");

            ///<summary>地区</summary>
            public static readonly FieldItem U_Area = FindByName("U_Area");

            ///<summary>地址</summary>
            public static readonly FieldItem U_Address = FindByName("U_Address");

            ///<summary>用户类型0:超级用户1:普通用户</summary>
            public static readonly FieldItem U_Type = FindByName("U_Type");

            ///<summary>当前状态0:正常 1:禁止登陆 2:删除</summary>
            public static readonly FieldItem U_Status = FindByName("U_Status");

            ///<summary>更新时间</summary>
            public static readonly FieldItem U_DateTime = FindByName("U_DateTime");

            ///<summary>最后访问IP</summary>
            public static readonly FieldItem U_LastIP = FindByName("U_LastIP");

            ///<summary>最后访问时间</summary>
            public static readonly FieldItem U_LastDateTime = FindByName("U_LastDateTime");

            ///<summary>扩展字段</summary>
            public static readonly FieldItem U_ExtendField = FindByName("U_ExtendField");

            ///<summary>登入类型(为空系统认证,其它值为其它认证)</summary>
            public static readonly FieldItem U_LoginType = FindByName("U_LoginType");

            static FieldItem FindByName(String name) { return Meta.Table.FindByName(name); }
        }
        #endregion
    }

    /// <summary>用户表接口</summary>
    public partial interface Isys_UserTable
    {
        #region 属性
        /// <summary>用户ID号</summary>
        Int32 UserID { get; set; }

        /// <summary>登陆名</summary>
        String U_LoginName { get; set; }

        /// <summary>密码md5加密字符</summary>
        String U_Password { get; set; }

        /// <summary>部门ID号与sys_Group表中GroupID关联</summary>
        Int32 U_GroupID { get; set; }

        /// <summary>电子邮件</summary>
        String U_Email { get; set; }

        /// <summary>邮箱认证状态(0:未认证,1:认证)</summary>
        Int32 U_EmailState { get; set; }

        /// <summary>手机</summary>
        String U_Phone { get; set; }

        /// <summary>地区</summary>
        Int32 U_Area { get; set; }

        /// <summary>地址</summary>
        String U_Address { get; set; }

        /// <summary>用户类型0:超级用户1:普通用户</summary>
        Int32 U_Type { get; set; }

        /// <summary>当前状态0:正常 1:禁止登陆 2:删除</summary>
        Int32 U_Status { get; set; }

        /// <summary>更新时间</summary>
        DateTime U_DateTime { get; set; }

        /// <summary>最后访问IP</summary>
        String U_LastIP { get; set; }

        /// <summary>最后访问时间</summary>
        DateTime U_LastDateTime { get; set; }

        /// <summary>扩展字段</summary>
        String U_ExtendField { get; set; }

        /// <summary>登入类型(为空系统认证,其它值为其它认证)</summary>
        String U_LoginType { get; set; }
        #endregion

        #region 获取/设置 字段值
        /// <summary>
        /// 获取/设置 字段值。
        /// </summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        Object this[String name] { get; set; }
        #endregion
    }
}